class Admin::UsersController < Admin::BaseController
  before_filter :get_user, :except => :index

  def index
    @search = User.feed.search(params[:search])
    @users = @search.page(params[:page])
  end

  def roles
    roles = Role.where(:id => params[:user][:roles])
    if (@user.roles = roles)
      redirect_to admin_users_path, :notice => "User successfully updated"
    else
      redirect_to :back, :alert => "Error"
    end
  end

  protected
    def get_user
      @user = User.feed.find(params[:id])
    end
end


